package com.wondream.java.io.example;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class OutputStreamWriterTest {

    public static void main(String[] args) {
        OutputStreamWriter osw = null;
        try{
            File file = new File("./logs/oswData.txt");
            osw = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
//            String msg = "Hello,OutputStreamWriter";
            String msg = "Hello,你好";
            osw.write(msg);
        } catch (Exception e){

        } finally {
            try {
                if(osw!=null){
                    osw.close();
                    osw = null;
                }
            } catch (Exception e){}
        }
    }

}
